package Coursework;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ToDoList implements Serializable{
	private List<ToDoListItem> todoList;
	private int id;
	public ToDoList(){
		this.todoList = new ArrayList<ToDoListItem>();
		id = 0;
	}
	public List<ToDoListItem> getTodoList() {
		return todoList;
	}
	public void setTodoList(List<ToDoListItem> todoList) {
		this.todoList = todoList;
	}
	public List<ToDoListItem> getListOrderByPriorityAndDueDate(){
		List<ToDoListItem> tempList = new ArrayList<ToDoListItem>();
		for(int i=0;i<todoList.size();i++){
			tempList.add(todoList.get(i));
		}
		Collections.sort(tempList);
		return tempList;
	}
	public int getNextId(){
		return id;
	}
	public int size(){
		return todoList.size();
	}
	public void add(ToDoListItem item){
		todoList.add(item);
		id++;
	}
}
